1. Field of the Invention
Embodiments of the present invention relate generally to computer user interface (UI) and more particularly handling UI events.
2. Description of the Related Art
Recently, mobile computers and wireless phones have evolved to replace mainstream desktop computers. These mobile devices run on batteries that are charged from time to time. To support applications and usage that require higher processing power, mobile devices are being manufactured with powerful processors and supporting hardware. This increased processing power, however, has a side effect, that is, high capacity batteries are needed and the batteries need to be charged more frequently. To keep the mobile devices light and small, the battery size cannot be increased beyond a reasonable size and users of these mobile devices may not have access to battery charging means at all time. Hence, prolonging the battery charge cycles would prove to be beneficial by designing software applications that exert less burden on the batteries.
It is common for software applications to use multiple threads to implement task parallelism. In an exemplary software application, many threads may be employed as for example, one thread to retrieve data from an external server and another thread to listen to user interaction with the user interface of the exemplary software application. If there were only one thread handling both the above stated exemplary tasks, the application would become unresponsive to user interactions until the first thread finishes retrieving data from the external server. In the meantime, the user may feel as if the application has “hanged” and may try to kill the application. At the very least, such application designs would provide a reduced quality user experience. On the other hand, using multiple threads for different tasks would lead to higher CPU consumption and would result in an undesirable outcome, that is, the battery would need to be charged more frequently.
Further, it may not be possible in some scenarios to have multiple threads. For example, software applications that include legacy code may not be amended to use multiple threads without making them unstable.
Therefore, what is needed is a mechanism to create single threaded software modules that enables an application to be more responsive to user interactions while performing multiple tasks.